package com.xsm.DataBase;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DataHelper extends SQLiteOpenHelper{

	public DataHelper(Context context, String name, CursorFactory factory,
			int version) {
		super(context, name, factory, version);
	}
	public void onCreate(SQLiteDatabase arg0) {
		String sql1="create table textbooka (textbookaid int primary key,namea text,parentid int,gparentid int)";
		String sql2="create table textbookb (textbookbid int primary key,nameb text,parentid int,gparentid int)";
		String sql3="create table textbookc (textbookcid int primary key,namec text,parentid int,gparentid int)";
        String sql4="create table press(pressid INTEGER primary key,pressname text)";
        String sql5="create table Books(goodsid int primary key,bookname text,press text,school text,time text,userid text,username text,explain text,buytype text,booktype text,price text,phone text,gparentid text)";
        String sql6="create table Quanzi(quanziid int primary key,content text,time text,userid text,username text,zancount text,ruocount text)";
        String sql7="create table News(id int primary key,content text)";
        String sql8="create table Recommend(rid INTEGER PRIMARY KEY,classify text,gparentname text)";
try {
arg0.execSQL(sql1);
} catch (Exception e) {
	Log.d("my", e+"");
}

try {
	arg0.execSQL(sql2);
} catch (Exception e) {
	Log.d("my", e+"");
}

try {
	arg0.execSQL(sql3);
} catch (Exception e) {
	Log.d("my", e+"");
}

try {
	arg0.execSQL(sql4);
} catch (Exception e) {
	Log.d("my", e+"");
}

try {
	arg0.execSQL(sql5);
} catch (Exception e) {
	Log.d("my", e+"");
}

try {
	arg0.execSQL(sql6);
} catch (Exception e) {
	Log.d("my", e+"");
}

try {
	arg0.execSQL(sql7);
} catch (Exception e) {
	Log.d("my", e+"");
}

try {
	arg0.execSQL(sql8);
} catch (Exception e) {
	Log.d("my", e+"");
}
	}
	public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {
	}

}
